module Instruction_memory(CLK, i_address,instruction, reset);
   input  CLK;
   input [31:0] i_address;
   input        reset;
   output [31:0] instruction;

   reg [31:0]    imem[0:512];

   always @(posedge reset) begin
imem[0]<=32'b00000000000000000000000000000000;
imem[1]<=32'b00000000000000000000000000000000;
imem[2]<=32'b00000000000000000000000000000000;
imem[3]<=32'b00000000000000000000000000000000;
imem[4]<=32'b00000000000000000000000000000000;
imem[5]<=32'b00000000000000000000000000000000;
// 
imem[6]<=32'b10010010000010000000000000000001;
imem[7]<=32'b10010010000100000000000000000000;
imem[8]<=32'b10010010000110000000000000010000;
imem[9]<=32'b10010010001000000000000000010000;
// lapwhile:
imem[10]<=32'b01010001000010010000000000011001;
imem[11]<=32'b00000000000000000000000000000000;
imem[12]<=32'b00000000000000000000000000000000;
imem[13]<=32'b00000000000010000010010000000000;
imem[14]<=32'b00000000000010000010011000000000;
imem[15]<=32'b00000000000100000010000000000000;
imem[16]<=32'b00000000000100000110001000000000;
imem[17]<=32'b00000000000110000010100000000000;
// mergewhile:
imem[18]<=32'b01010001100000001100000000001101;
imem[19]<=32'b00000000000000000000000000000000;
imem[20]<=32'b00000000000000000000000000000000;
imem[21]<=32'b01010001000000000000000000100000;
imem[22]<=32'b00000000000000000000000000000000;
imem[23]<=32'b00000000000000000000000000000000;
// mergedone:
imem[24]<=32'b00000000100000000110000000000000;
imem[25]<=32'b00000000100000000110000000000000;
imem[26]<=32'b00000000100010000110001000000000;
imem[27]<=32'b00000000100010000110001000000000;
imem[28]<=32'b01010001000000000011111111110110;
imem[29]<=32'b00000000101000000110100000000000;
imem[30]<=32'b00000000101000000110100000000000;
// mergewhileend:
imem[31]<=32'b00000000000010000100001000000000;
imem[32]<=32'b01010001000000000011111111101010;
imem[33]<=32'b00000000000100010000010000000000;
imem[34]<=32'b00000000000110010000011000000000;
// lapend:
// 
imem[35]<=32'b00000000000000000000001000000000;
imem[36]<=32'b10010011000100000000000000000000;
imem[37]<=32'b10010010000100000000000001010000;
imem[38]<=32'b10010011000110000000000000000000;
imem[39]<=32'b10010010000110000000000000000001;
// outputwhile:
imem[40]<=32'b01010001000010001000000000000110;
imem[41]<=32'b00000000000000000000000000000000;
imem[42]<=32'b00000000000000000000000000000000;
imem[43]<=32'b01010001000000000011111111111101;
imem[44]<=32'b00100000000010000011111000000000;
imem[45]<=32'b00000000000010001100001000000000;
// outputend:
// 
// spin:
imem[46]<=32'b01010001000000000000000000000000;
imem[47]<=32'b00000000000000000000000000000000;
imem[48]<=32'b00000000000000000000000000000000;
// 
imem[49]<=32'b10010010100010000000000000000100;
imem[50]<=32'b10010010100100000000000000000100;
imem[51]<=32'b10010010100110000000000000000100;
imem[52]<=32'b10010010101000000000000000001000;
// merge:
imem[53]<=32'b10010010110010000000000000000001;
imem[54]<=32'b10010011110010000000000000000000;
imem[55]<=32'b00000000000000000010101000000000;
imem[56]<=32'b00000000000000000010110000000000;
imem[57]<=32'b00000000000000000011010000000000;
// whilestart:
imem[58]<=32'b01010001101011001000000000010011;
imem[59]<=32'b00000000000000000000000000000000;
imem[60]<=32'b00000000000000000000000000000000;
imem[61]<=32'b01010001101101001100000000010000;
imem[62]<=32'b00000000000000000000000000000000;
imem[63]<=32'b00000000000000000000000000000000;
imem[64]<=32'b00100000100001010110111000000000;
imem[65]<=32'b00100000100011011011000000000000;
imem[66]<=32'b01110001101111100000000000000111;
imem[67]<=32'b00000000000000000000000000000000;
imem[68]<=32'b00000000000000000000000000000000;
// # from here B is smaller
imem[69]<=32'b00110000101001101011000000000000;
imem[70]<=32'b01010001000000000011111111110100;
imem[71]<=32'b00000000101101100110110000000000;
imem[72]<=32'b00000000110101100111010000000000;
// Asmall:
imem[73]<=32'b00110000101001101010111000000000;
imem[74]<=32'b01010001000000000011111111110000;
imem[75]<=32'b00000000101011100110101000000000;
imem[76]<=32'b00000000110101100111010000000000;
// whileend:
// whileA:
imem[77]<=32'b01010001100101010100000000001000;
imem[78]<=32'b00000000000000000000000000000000;
imem[79]<=32'b00000000000000000000000000000000;
imem[80]<=32'b00100000100001010110111000000000;
imem[81]<=32'b00110000101001101010111000000000;
imem[82]<=32'b01010001000000000011111111111011;
imem[83]<=32'b00000000101011100110101000000000;
imem[84]<=32'b00000000110101100111010000000000;
// finishA:
// whileB:
imem[85]<=32'b01010001100111011000000000001000;
imem[86]<=32'b00000000000000000000000000000000;
imem[87]<=32'b00000000000000000000000000000000;
imem[88]<=32'b00100000100011011011000000000000;
imem[89]<=32'b00110000101001101011000000000000;
imem[90]<=32'b01010001000000000011111111111011;
imem[91]<=32'b00000000101101100110110000000000;
imem[92]<=32'b00000000110101100111010000000000;
// finishB:
imem[93]<=32'b01010001000000000011111110111011;
imem[94]<=32'b00000000000000000000000000000000;
imem[95]<=32'b00000000000000000000000000000000;
   end

   assign instruction = imem[i_address];

	//im_under under(.a(i_address), .spo(instruction));

endmodule
